{"ast":null,"code":"export function createTrackingData(reaction) {\n  var trackingData = {\n    reaction: reaction,\n    mounted: false,\n    changedBeforeMount: false,\n    cleanAt: Date.now() + CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS\n  };\n  return trackingData;\n}\n/**\n * The minimum time before we'll clean up a Reaction created in a render\n * for a component that hasn't managed to run its effects. This needs to\n * be big enough to ensure that a component won't turn up and have its\n * effects run without being re-rendered.\n */\nexport var CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS = 10000;\n/**\n * The frequency with which we'll check for leaked reactions.\n */\nexport var CLEANUP_TIMER_LOOP_MILLIS = 10000;","map":{"version":3,"mappings":"AAEA,OAAM,SAAUA,kBAAkB,CAACC,QAAkB;EACjD,IAAMC,YAAY,GAAsB;IACpCD,QAAQ;IACRE,OAAO,EAAE,KAAK;IACdC,kBAAkB,EAAE,KAAK;IACzBC,OAAO,EAAEC,IAAI,CAACC,GAAG,EAAE,GAAGC;GACzB;EACD,OAAON,YAAY;AACvB;AAkDA;;;;;;AAMA,OAAO,IAAMM,qCAAqC,GAAG,KAAM;AAE3D;;;AAGA,OAAO,IAAMC,yBAAyB,GAAG,KAAM","names":["createTrackingData","reaction","trackingData","mounted","changedBeforeMount","cleanAt","Date","now","CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS","CLEANUP_TIMER_LOOP_MILLIS"],"sources":["/data/messenger.client/node_modules/mobx-react-lite/src/utils/reactionCleanupTrackingCommon.ts"],"sourcesContent":["import { Reaction } from \"mobx\"\n\nexport function createTrackingData(reaction: Reaction) {\n    const trackingData: IReactionTracking = {\n        reaction,\n        mounted: false,\n        changedBeforeMount: false,\n        cleanAt: Date.now() + CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS\n    }\n    return trackingData\n}\n\n/**\n * Unified api for timers/Finalization registry cleanups\n * This abstraction make useObserver much simpler\n */\nexport interface ReactionCleanupTracking {\n    /**\n     *\n     * @param reaction The reaction to cleanup\n     * @param objectRetainedByReact This will be in actual use only when FinalizationRegister is in use\n     */\n    addReactionToTrack(\n        reactionTrackingRef: React.MutableRefObject<IReactionTracking | null>,\n        reaction: Reaction,\n        objectRetainedByReact: object\n    ): IReactionTracking\n    recordReactionAsCommitted(reactionRef: React.MutableRefObject<IReactionTracking | null>): void\n    forceCleanupTimerToRunNowForTests(): void\n    resetCleanupScheduleForTests(): void\n}\n\nexport interface IReactionTracking {\n    /** The Reaction created during first render, which may be leaked */\n    reaction: Reaction\n    /**\n     * The time (in ticks) at which point we should dispose of the reaction\n     * if this component hasn't yet been fully mounted.\n     */\n    cleanAt: number\n\n    /**\n     * Whether the component has yet completed mounting (for us, whether\n     * its useEffect has run)\n     */\n    mounted: boolean\n\n    /**\n     * Whether the observables that the component is tracking changed between\n     * the first render and the first useEffect.\n     */\n    changedBeforeMount: boolean\n\n    /**\n     * In case we are using finalization registry based cleanup,\n     * this will hold the cleanup token associated with this reaction\n     */\n    finalizationRegistryCleanupToken?: number\n}\n\n/**\n * The minimum time before we'll clean up a Reaction created in a render\n * for a component that hasn't managed to run its effects. This needs to\n * be big enough to ensure that a component won't turn up and have its\n * effects run without being re-rendered.\n */\nexport const CLEANUP_LEAKED_REACTIONS_AFTER_MILLIS = 10_000\n\n/**\n * The frequency with which we'll check for leaked reactions.\n */\nexport const CLEANUP_TIMER_LOOP_MILLIS = 10_000\n"]},"metadata":{},"sourceType":"module"}